﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="manager_SpecialEval_Default" %>


<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <title>特殊考评</title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder" runat="Server">
    <section class="content-header">
        <h1>特殊考评
            <small>特殊考评</small>
        </h1>
        <ol class="breadcrumb">
            <li><a><i class="fa fa-dashboard"></i>主页</a></li>
            <li><a href="userManager.aspx">特殊考评</a></li>
            <li class="active">特殊考评</li>
        </ol>
    </section>

    <section class="content">

        <div class="box box-primary">
            <div class="box-header with-border">
                <h3 class="box-title">特殊考评</h3>
            </div>
            <div class="box-header with-border">
                <div>
                    <div class="col-md-12">
                        <button type="button" class="btn btn-success" data-toggle="modal" data-target="#moduleManager" data-action="add">添加特殊考评</button>
                    </div>
                </div>
            </div>
            <ul class="nav nav-tabs" role="tablist">
                <li role="presentation" class="active"><a href="#task1" role="tab" data-toggle="tab">手动添加</a></li>
                <li role="presentation"><a href="#task2" role="tab" data-toggle="tab">金蝶导入</a></li>
            </ul>
            <div class="tab-content">
                <div role="tabpanel" class="tab-pane active" id="task1">
                    <div class="box-body">
                        <table id="userManagerList1" class="table table-bordered table-striped">
                            <thead>
                                <tr>
                                    <th></th>
                                    <th>日期</th>
                                    <th>事由</th>
                                    <th>岗位</th>
                                    <th>加减</th>
                                    <th>分值</th>
                                    <th>状态</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
                                <asp:Repeater ID="rptDeApply_1" runat="server">
                                    <ItemTemplate>
                                        <tr>
                                            <td><%# Eval("id") %></td>
                                            <td><%# Convert.ToDateTime(Eval("rq")).ToString("yyyy-MM-dd") %></td>
                                            <td><%# Eval("title") %></td>

                                            <td><%# Eval("mc") %>|<%# Eval("psname") %></td>
                                            <td><%# Eval("IsAdd") %></td>
                                            <td><%# Eval("fz") %></td>
                                            <td><%# Eval("isUsing").ToString().Trim()=="True"?"<span style='color:green'>可用</span>":"<span style='color:red'>不可用</span>" %></td>
                                            <td><a data-toggle="modal" data-target="#moduleManager" data-action="update" data-bid="<%# Eval("ID") %>">修改</a></td>
                                        </tr>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </tbody>
                        </table>
                    </div>
                </div>
                <div role="tabpanel" class="tab-pane" id="task2">
                    <div class="box-body">
                        <table id="userManagerList2" class="table table-bordered table-striped">
                            <thead>
                                <tr>
                                    <th></th>
                                    <th>日期</th>
                                    <th>事由</th>
                                    <th>岗位</th>
                                    <th>加减</th>
                                    <th>分值</th>
                                    <th>状态</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
                                <asp:Repeater ID="rptDeApply_2" runat="server">
                                    <ItemTemplate>
                                        <tr>
                                            <td><%# Eval("id") %></td>
                                            <td><%# Convert.ToDateTime(Eval("rq")).ToString("yyyy-MM-dd") %></td>
                                            <td><%# Eval("title") %></td>
                                            <td><%# Eval("mc") %>|<%# Eval("psname") %></td>
                                            <td><%# Eval("IsAdd") %></td>
                                            <td><%# Eval("fz") %></td>
                                            <td><%# Eval("isUsing").ToString().Trim()=="True"?"<span style='color:green'>可用</span>":"<span style='color:red'>不可用</span>" %></td>
                                            <td><a data-toggle="modal" data-target="#moduleManager" data-action="update" data-bid="<%# Eval("ID") %>">修改</a></td>
                                        </tr>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            <div class="modal fade" id="moduleManager" role="dialog" aria-labelledby="moduleManagerLabel">
                <div class="modal-dialog" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title" id="userManagerLabel"></h4>
                            <asp:HiddenField ID="hidBID" runat="server" />
                        </div>
                        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
                        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                            <ContentTemplate>
                                <div style="display: none">
                                    <asp:Button ID="btnGet" runat="server" Text="Get" OnClick="btnGet_Click" />
                                </div>
                                <div class="modal-body">
                                    <table class="table table-bordered">
                                        <tr>
                                            <td class="col-sm-3">日期</td>
                                            <td>
                                                <asp:TextBox ID="txt_rq" CssClass="form-control" runat="server"></asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="col-sm-3">岗位</td>
                                            <td>
                                                <a data-toggle="modal" data-target="#moduleManager1">
                                                    <input type="text" id="txt_ps_mc" class="form-control" placeholder="必填，此次扣分岗位" runat="server" /></a>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="col-sm-3">标题</td>
                                            <td>
                                                <asp:TextBox ID="txt_mc" CssClass="form-control" runat="server"></asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>加分减分</td>
                                            <td>
                                                <asp:DropDownList ID="ddlIsAdd" CssClass="form-control" runat="server">
                                                    <asp:ListItem Value="0">扣分</asp:ListItem>
                                                    <asp:ListItem Value="1">加分</asp:ListItem>
                                                </asp:DropDownList>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="col-sm-3">分值</td>
                                            <td>
                                                <asp:TextBox ID="txt_fz" CssClass="form-control" runat="server" placeholder="直接输入扣分分值,不需要输入+-"></asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>可用</td>
                                            <td>
                                                <asp:DropDownList ID="ddlIsUsing" CssClass="form-control" runat="server">
                                                    <asp:ListItem Value="1">可用</asp:ListItem>
                                                    <asp:ListItem Value="0">不可用</asp:ListItem>
                                                </asp:DropDownList>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                            <asp:Button ID="btnUpdate" runat="server" Text="保存" CssClass="btn btn-primary" OnClick="btnUpdate_Click" />
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="modal fade" id="moduleManager1" role="dialog" aria-labelledby="moduleManagerLabel">
            <div class="modal-dialog" role="document" style="width: 1000px">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="userManagerLabel1">选择验收岗位(单击名称选择)</h4>
                    </div>
                    <div class="modal-body">
                        <ul class="nav nav-tabs" role="tablist">
                            <%=Html_Dept %>
                        </ul>
                        <div class="tab-content">
                            <%=Html_Dept_Detail %>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div style="display: none;">
            <input type="text" id="dept_id" runat="server" />
            <input type="text" id="txt_ps_id" runat="server" />
        </div>
    </section>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ScriptPlaceHolder" runat="Server">
    <script src="/reference/plugins/moment/moment.min.js"></script>
    <script src="/reference/plugins/moment/moment-with-locales.min.js"></script>
    <script src="/reference/plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
    <script>
        $('#ContentPlaceHolder_txt_rq').datetimepicker({
            locale: 'zh-cn',
            format: "YYYY-MM-DD"
        });

        $(document).ready(function () {
            $("#userManagerList1").DataTable(
                {
                    "columnDefs": [
                        { "targets": [0], "visible": false }
                    ],
                    "autoWidth": true,
                    "ordering": false,
                    "scroll": true,
                    "language": {
                        "url": "/reference/plugins/datatables/Chinese.json"
                    }
                });
        });
        $(document).ready(function () {
            $("#userManagerList2").DataTable(
                {
                    "columnDefs": [
                        { "targets": [0], "visible": false }
                    ],
                    "autoWidth": true,
                    "ordering": false,
                    "scroll": true,
                    "language": {
                        "url": "/reference/plugins/datatables/Chinese.json"
                    }
                });
        });
        $(document).ready(function () {
            var type = $("#ContentPlaceHolder_dept_id").val();
            var arr_dept = type.split("|");
            for (var i = 0; i < arr_dept.length; i++) {
                $("#table_" + arr_dept[i]).DataTable(
                               {
                                   "columnDefs": [
                                       { "targets": [0], "visible": false }
                                   ],
                                   "autoWidth": true,
                                   "ordering": false,
                                   "scroll": true,
                                   "language": {
                                       "url": "/reference/plugins/datatables/Chinese.json"
                                   }
                               });
            }
            var type = $("#ContentPlaceHolder_type_value").val();
        });

        function SetYsGw(id, mc) {
            $("#ContentPlaceHolder_txt_ps_id").val(id);
            $("#ContentPlaceHolder_txt_ps_mc").val(mc);
            $('#moduleManager1').modal('hide')
        }





        $('#moduleManager').on('show.bs.modal', function (event) {
            var button = $(event.relatedTarget)
            $("#ContentPlaceHolder_hidBID").val("");
            var action = button.data('action');
            if (action == "update") {
                var browserID = button.data('bid');

                $("#userManagerLabel").text("修改部门");



                $("#ContentPlaceHolder_hidBID").val(browserID);
                $("#ContentPlaceHolder_btnGet").click();
            }
            else if (action == "add") {
                $("#userManagerLabel").text("新增部门");
            }

        })


    </script>
</asp:Content>

